# 将README.md中的相对图片地址替换为url
import re

URLS = {
    # 'version': 'https://img.shields.io/visual-studio-marketplace/v/lan.dst-lan',
    # 'installs': 'https://img.shields.io/visual-studio-marketplace/i/lan.dst-lan',
    # 'downloads': 'https://img.shields.io/visual-studio-marketplace/d/lan.dst-lan',
    'help': 'https://steamuserimages-a.akamaihd.net/ugc/2468624856960789782/17331F034171FFEFF8DB8EED841DE4EBE1D09063/',
    'prefab_search': 'https://steamuserimages-a.akamaihd.net/ugc/2468624856982815335/05F7E3995AC2BAEACF79FACEFD4FEACF1EA5160E/',
    'prefab_search_cn': 'https://steamuserimages-a.akamaihd.net/ugc/2468624856982817738/56C12813F789B8AA911CCFB659FE8F26E2595157/',
    '注释吧': 'https://steamuserimages-a.akamaihd.net/ugc/2388684695483120626/B27DAD8159FA22B4DC2525A08BE21013E81EDADC/',
    '补全预览': 'https://steamuserimages-a.akamaihd.net/ugc/2468624856954010291/D4059CB12142D03188714C7C4B0575CCFD0E9B42/',
    '进来写两句注释吧': 'https://steamuserimages-a.akamaihd.net/ugc/2388684695474859445/023E78EAFE2D1954815252CDD3EBADDE3403FE3E/',
    'special_icon': 'https://steamuserimages-a.akamaihd.net/ugc/2466373690658484524/ADC08D6F7054505A7B25B1A63A67EDAD1639BDF2/',
    'toggle': 'https://steamuserimages-a.akamaihd.net/ugc/2466373690670046945/2469551DCC20D2BB72BA35693659D0AC0AEF5AA4/',
}

with open('README.md', 'r', encoding='utf-8') as f:
    content = f.read()

# 修正后的正则表达式
for k, v in URLS.items():
    content = re.sub(f'!\[{k}\]\((.*?)\)', f'![{k}]({v})', content)

with open('README.md', 'w', encoding='utf-8') as f:
    f.write(content)